<include file="/public/header" />
<div class="layui-fluid">
    <div class="layui-card">
        <!-- // 默认操作按钮 -->
        <div class="layui-card-header layadmin-card-header-auto ">
        <div class="layui-form">
            <div class="layui-form-item">
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <select name="status">
                        <option value="">{:__('按状态查询')}</option>
                        <option value="2" >{:__('已审核')}</option>                                 
                        <option value="1" >{:__('未审核')}</option>
                    </select>
                </div>  
            </div>

            <div class="layui-inline"><div class="layui-input-inline ">
                <input name="nickname" class="layui-input" type="text" placeholder="{:__('关键字搜索')}"/></div>
            </div>

            <div class="layui-inline" >
                <!-- // 默认搜索 -->
                <button class="layui-btn icon-btn" lay-filter="formSearch" lay-submit><i class="layui-icon layui-icon-search"></i>{:__('搜索')}</button>
                <!-- // 删除所有 -->
                <button class="layui-btn icon-btn layui-btn-danger" lay-batch="lay-tableList" data-field="cid"  data-url="{:url('/system.comment/del')}" >
                  <i class="layui-icon layui-icon-delete"></i>{:__('删除')}
                </button>
            </div>
            </div>
        </div>   
        </div>

        <!-- // 创建数据实例 -->
        <table id="lay-tableList" lay-filter="lay-tableList"></table>        
    </div>
</div>

<!-- // 列表状态栏 -->
<script type="text/html" id="columnStatus">
    <input type="checkbox" lay-filter="switchStatus" data-url="{:url('/system.comment/status')}" value="{{d.id}}" lay-skin="switch" {{d.status==1?'checked':''}}  />
</script>

<!-- // 列表工具栏 -->
<script type="text/html" id="tableBar"> 
    <a class="layui-table-text" data-title="{:__('查看评论')}" data-area="80%,85%" data-offset="50px"
        data-url="{:url('/system.comment/view')}?id={{d.id}}" lay-event="edit">{:__('查看')}</a>
    <div class="layui-divider layui-divider-vertical"></div>
    <a class="layui-table-text" data-url="{:url('/system.comment/del')}?id={{d.id}}" lay-event="del">{:__('删除')}</a>
</script>

<include file="/public/footer" />
<script>
    layui.use(['table'], function () {

        var table = layui.table;
        /*
         * 初始化表格
        */
        var isTable = table.render({
            elem: "#lay-tableList"
            ,url: "{:url('/system.comment/index')}"
            ,page: true
            ,limit: 18
            ,cols: [[
                {type: 'checkbox', width:45},
                {field: 'id', align: 'center',sort: true,width: 80,  title: 'ID'},
                {field: 'user_id', align: 'center',sort: true,width: 100,templet:function(d){
                    return d.user_id == 0 ? '无' : d.user_id;
                },  title: '用户ID'},
                {field: 'nickname', align: 'left', width:120,templet:function(d){
                    return d.nickname === undefined ? '游客' : d.nickname;
                },title: '{:__("昵称")}'},
                {field: 'content', align: 'left',title: '{:__("评论内容")}'},                
                {field: 'count', align: 'center',width:60,title: '{:__("回复")}'},
                {field: 'sid', align: 'center',width:80,title: '{:__("来源")}'},
                {field: 'status', align: 'center',width:120,templet:'#columnStatus',title: '{:__("状态")}'},
                {field: 'ip', align: 'center',width:160,title: '{:__("登录IP")}'},
                {field: 'createtime', align: 'center', width:160,templet: '<div>{{ layui.util.toDateString(d.createtime*1000, "yyyy-MM-dd HH:mm:ss") }}</div>',  title: '{:__("评论时间")}'},
                {align: 'center', toolbar: '#tableBar', width:160, title: '{:__("操作")}'},
            ]]
        })

    })
</script>
